package com.lagou.service.impl;

import com.lagou.service.DemoService;
import org.apache.commons.lang3.RandomUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author xingyi
 */
@DubboService
public class DemoServiceImpl implements DemoService {
    private static final Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class);

    @Override
    public void methodA() {
        logger.info("invoked methodA");
        sleepRandomTime();
    }

    private void sleepRandomTime() {
        try {
            Thread.sleep(RandomUtils.nextLong(0, 100));
        } catch (InterruptedException ignored) {

        }
    }

    @Override
    public void methodB() {
        logger.info("invoked methodB");
        sleepRandomTime();
    }

    @Override
    public void methodC() {
        logger.info("invoked methodC");
        sleepRandomTime();
    }
}
